﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using vkUpploaderLib;

namespace vkUpploaderApp
{
    static class Program
    {

        public static bool Terminate;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (Properties.Settings.Default.CurrentCulture != null)
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(Properties.Settings.Default.CurrentCulture);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (DateTime.Now > Properties.Settings.Default.TokenExpires)
            {
                Application.Run(new frmLogin());
            }
            if (!Terminate)
            {
                AuthHelper.Token = Properties.Settings.Default.Token;
                AuthHelper.UserID = Properties.Settings.Default.UserID;
                AuthHelper.TokenExpires = Properties.Settings.Default.TokenExpires;
                Application.Run(new frmTray());
            }
        }

    }
}
